package com.gaimall.beans.pagebean;

import java.util.ArrayList;
import java.util.List;

import com.gaimall.beans.pagebean.element.Recom_item;
import com.gaimall.beans.xmlbean.Data;
import com.gaimall.beans.xmlbean.Item;
import com.gaimall.beans.xmlbean.Result_recom;

public class RecomPage {

	private List<Recom_item> type91;
	private List<Recom_item> type92;
	private List<Recom_item> type93;

	public RecomPage() {
		this.type91 = new ArrayList<Recom_item>();
		this.type92 = new ArrayList<Recom_item>();
		this.type93 = new ArrayList<Recom_item>();
	}

	public RecomPage(Result_recom rr) {
		this();

		
		if (rr.getData_list()==null||rr.getData_list().size()<3) {
			return;
		}
		// fill 91
		for (Data d : rr.getData_list()) {
			if ("91".equals(d.getType())) {
				for (Item i : d.getItem_list()) {
					String name = i.getName();
					String url = "/gaimall/item?id=" + i.getId() + "&page=1";
					String picurl = i.getPicUrl();
					String price = i.getPrice();
					Recom_item recom_item = new Recom_item(name, url, picurl, price);
					this.type91.add(recom_item);
				}

			}
		}

		// fill 92
		for (Data d : rr.getData_list()) {
			if ("92".equals(d.getType())) {
				for (Item i : d.getItem_list()) {
					String name = i.getName();
					String url = "/gaimall/item?id=" + i.getId() + "&page=1";
					String picurl = i.getPicUrl();
					String price = i.getPrice();
					Recom_item recom_item = new Recom_item(name, url, picurl, price);
					this.type92.add(recom_item);
				}
			}
		}

		// fill 93
		for (Data d : rr.getData_list()) {
			if ("93".equals(d.getType())) {
				for (Item i : d.getItem_list()) {
					String name = i.getName();
					String url = "/gaimall/item?id=" + i.getId() + "&page=1";
					String picurl = i.getPicUrl();
					String price = i.getPrice();
					Recom_item recom_item = new Recom_item(name, url, picurl, price);
					this.type93.add(recom_item);
				}
			}
		}
	}

	public List<Recom_item> getType91() {
		return type91;
	}

	public void setType91(List<Recom_item> type91) {
		this.type91 = type91;
	}

	public List<Recom_item> getType92() {
		return type92;
	}

	public void setType92(List<Recom_item> type92) {
		this.type92 = type92;
	}

	public List<Recom_item> getType93() {
		return type93;
	}

	public void setType93(List<Recom_item> type93) {
		this.type93 = type93;
	}

}
